import $ from "@/utils/requset"
// 登录
const postSyan = ({ account = null, password = null } = {})=>$.postAxios("/login",{account,password})
// 商品分类二级 列表
const menuApi = (id)=>$.getAxios('/category/sub/filter',{id})
// 列表数据 
const menuLisApi = ({page:num}) => $.postAxios('/category/goods/temporary',{
    page:num,
    // pageSize: pageSize
})

// 首页数据
const homeApi=()=>$.getAxios("/home/index");
// 热门品牌
const rmBrands=()=>$.getAxios("/home/brand");
// 首页产品区块
const homeGoods=()=>$.getAxios("/home/goods");
// 首页最新专题
const homeNewApi=()=>$.getAxios("/home/special");

// 购物车
const ShopPing = () =>$.getAxios("/member/cart")
const ShopId = (id) =>$.getAxios("/goods",{id})
// 修改数据
const SelectedCount= (id,selected,count)=>$.putAxios(`/member/cart/${id}`,{
    selected,
    count
})
const Selecteds= (selected)=>$.putAxios(`/member/cart/selected`,{
    selected,
})
// 删除数据
const Delete=({ ids,clearAll=false,clearInvalid=false} = {})=>$.deleteAxios('/member/cart',{
    ids,
    clearAll,
    clearInvalid
})
// 猜你喜欢
const guessLike=(page,pageSize,orderState)=>$.getAxios("/home/goods/guessLike",{
    page,
    pageSize,
    orderState
})

// 我的订单
const orderName=(page,pageSize)=>$.getAxios("/member/order",{
    page,
    pageSize
})

const getGoods = (id) => $.getAxios("goods",id)
export default {
    orderName,
    postSyan,
    homeApi,
    rmBrands,
    homeGoods,
    ShopPing,
    ShopId,
    SelectedCount,
    Selecteds,
    Delete,
    guessLike,
    homeNewApi,
    getGoods,
    menuApi,
    menuLisApi
}


